﻿using School;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestSchoolFuncionality
{
    [TestClass()]
    public class CourseTest
    {
        [TestMethod()]
        [ExpectedException(typeof(ArgumentOutOfRangeException), "This student is already enroled in this course")]
        public void AddStudentUniqueFacNumberTest()
        {
            Course target = new Course(); 
            Student newStudent = new Student("pesho",10101);
            Student otherStudent = new Student("gosho", 10101);
            target.AddStudent(newStudent);
            target.AddStudent(otherStudent);
        }

        [TestMethod()]
        [ExpectedException(typeof(ArgumentException), "The course is full")]
        public void AddStudentCourseFullTest() 
        {
            Course target = new Course();
            for (int i = 0; i < 40; i++) 
            {
                Student nextStudent = new Student(i.ToString(), i + 10000);
                target.AddStudent(nextStudent);
            }
        }

        [TestMethod()]
        public void AddStundetTest() 
        {
            Course target = new Course();
            Student newStudent = new Student("pesho",10101);
            bool result = target.AddStudent(newStudent);
            Assert.AreEqual(true, result);
        }
    }
}
